package com.cqupt.controller;

import com.cqupt.model.vo.Result;
import com.cqupt.model.vo.ResultCodeEnum;
import com.cqupt.model.vo.SpeakVO;
import com.cqupt.service.SparkService;
import com.cqupt.service.SpeakService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@Tag(name = "口语对话模块")
@RequestMapping("/api/speak")
public class SpeakController {

    @Resource
    private SparkService sparkService;

    @Resource
    private SpeakService speakService;

    @PostMapping("/chat")
    @Operation(summary = "口语对话接口")
    public Result chat(@RequestParam("id") int id, @RequestParam("file") MultipartFile file) {
        SpeakVO res = speakService.chat(id, file);
        return Result.build(res, ResultCodeEnum.SUCCESS);
    }



    @PostMapping("/test")
    @Operation(summary = "测试接口")
    public Result test(@RequestParam("file") MultipartFile file) {
        speakService.test(file);
        return Result.build(null, ResultCodeEnum.SUCCESS);
    }
}
